from fastapi import APIRouter
from pydantic import BaseModel

router = APIRouter()

# 问候响应模型
class GreetingResponse(BaseModel):
    message: str
    version: str = "v1"
    status: str = "success"


@router.get("/hello", response_model=GreetingResponse, summary="问候接口")
async def hello():
    """简单的问候接口"""
    return GreetingResponse(
        message="你好！欢迎使用 FastAPI V1 API！",
        version="v1",
        status="success"
    )


@router.get("/hello/{name}", response_model=GreetingResponse, summary="个性化问候")
async def hello_name(name: str):
    """个性化问候接口"""
    return GreetingResponse(
        message=f"你好，{name}！欢迎使用 FastAPI V1 API！",
        version="v1",
        status="success"
    )